clear 
clear matrix
set more off
capture log close
cd "C:\Users\J. Lawrence Broz\Dropbox\Fed_LLR\stats\hr459"
log using hr459_IOestimation.log, replace

use hr459_IO.dta

**Table 7, probit, dep var is vote
eststo: probit vote allocation_all if partynum==100, rob
eststo: probit vote allocation_all dwnom1 if partynum==100, rob
eststo: probit vote allocation_all dwnom1 OASDIpct foreclosures if partynum==100, rob
eststo: probit vote allocation_all dwnom1 OASDIpct foreclosures bankhq ch_senior finsvcs if partynum==100, rob
eststo: probit vote allocation_all dwnom1 OASDIpct foreclosures bankhq ch_senior finsvcs, rob
esttab using table7.rtf, replace compress b(3) star(* 0.10 ** 0.05 *** 0.01) se sfmt(a3)label ///
scalars("N Observations" "cmd Model" "r2_p Pseudo R2" "p P-Value" "ll Log Pseudo-likelihood" "chi2 Wald Chi2" )

eststo clear
clear
use hr459_IO.dta

**Clarify, Model 4 (mean plus 1 std dev--Dems only)
estsimp probit vote allocation_all dwnom1 foreclosures OASDIpct bankhq ch_senior finsvcs if partynum==100, rob
setx mean
setx (finsvcs bankhq) 0
simqi, fd(prval(1)) changex(allocation_all .0020763 .0059223)
simqi, fd(prval(1)) changex(dwnom1 -.3958325 -.2631885)
simqi, fd(prval(1)) changex(bankhq 0 1)
simqi, fd(prval(1)) changex(ch_senior 7.37766 12.360082)
simqi, fd(prval(1)) changex(finsvcs 0 1)
simqi, fd(prval(1)) changex(OASDIpct .1595929 .1986926)
simqi, fd(prval(1)) changex(foreclosures .0054806 .0132876)


drop b1 b2 b3 b4 b5 b6 b7 b8

eststo clear
clear
use hr459_IO.dta

**margins and marginsplot using table 7 model 4

**margins - Bank Contributions
probit vote c.allocation_all c.dwnom1 c.OASDIpct c.foreclosures i.bankhq c.ch_senior i.finsvcs if partynum==100, rob
margins, at(allocation_all=(0(.002).03))
marginsplot, title("Figure 7: Marginal Effects of Bank Contributions on Voting to Audit the Fed")
graph save marginsplot_hr459_bankcontributions, replace

**margins - Dem presidential vote share
probit vote c.allocation_all c.dwnom1 cc.OASDIpct c.foreclosures i.bankhq c.ch_senior i.finsvcs if partynum==100, rob
margins, at(dwnom1=(-.78(-.05)-.04))
marginsplot, title("Figure 8: Marginal Effects of Dem's 'Ideology' on Voting to Audit the Fed")
graph save marginsplot_hr459_DWnominate, replace 



